<template>
  <div>
    <el-page-header @back="goBack"> </el-page-header>
    <br>
    <el-table
      stripe
      :row-style="{height:'45px'}"
      :cell-style="{padding:'0px'}"
      style="font-size: 14px;width: 100%"
      :header-cell-style="{background:'#eef1f6',color:'#606266'}"
      :data= stuTable >
      <el-table-column
        prop="index"
        align="center"
        label="序号"
        width="80">
      </el-table-column>
      <el-table-column
        align="center"
        prop="stname"
        label="姓名"
        width="80"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="stid"
        label="学号"
        width="120"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="gender"
        label="性别"
        width="60"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="age"
        label="年龄"
        width="80"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="department"
        label="学校"
        width="120"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="college"
        label="专业"
        width="100"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="province"
        label="地址"
        width="100"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="level"
        label="抑郁程度"
        width="100"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="stype"
        label="学历"
        width="80"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column
        align="center"
        prop="year"
        label="入学年份"
        width="90"
        :show-overflow-tooltip='true' >
      </el-table-column>
      <el-table-column  align="center" label="设置">
        <template slot-scope="scope">
          <el-button
            size="mini"
            @click="showInfo( scope.row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
    export default {
        name: "seriousStu",
        created() {
            this.initData();
        },
        methods:{
            goBack () {
                this.$router.go(-1)
            },
            initData() {
                this.$axios.post("managementSystem/student/stuInfo",this.queryInfo)
                    .then(data => {
                        if (data.status != 200) {
                            this.$message.error('服务出错' + data.status);
                        } else {
                            var temp=data.data
                            this.stuTable=[]
                            for (var i in temp) {
                                if(temp[i]["level"]=="重度抑郁"){
                                    this.stuTable.push(temp[i])
                                }
                            }
                            for (var i in this.stuTable) {
                                this.stuTable[i]["index"] = parseInt(i) + 1;
                                if(this.stuTable[i]["stype"]==2){
                                    this.stuTable[i]["stype"] = '博士'
                                }else if(this.stuTable[i]["stype"] ==1){
                                    this.stuTable[i]["stype"] = '硕士'
                                }else if(this.stuTable[i]["stype"] ==0){
                                    this.stuTable[i]["stype"] = '本科'
                                }else if(this.stuTable[i]["stype"] ==3){
                                    this.stuTable[i]["stype"] = '初中'
                                }else if(this.stuTable[i]["stype"] ==4){
                                    this.stuTable[i]["stype"] = '高中'
                                }else if(this.stuTable[i]["stype"] ==5){
                                    this.stuTable[i]["stype"] = '大专'
                                }
                            }
                            console.log(this.stuTable)
                        }
                    })
            },
            showInfo(row){
                this.$router.push({path:"/home/stuInfoCheck",query:{info:row}});
            }
        },
        data() {
            return {
                queryInfo:{
                    universityName:"",
                    illness:""
                },
                illnessList:["无抑郁倾向" , "轻度抑郁", "中度抑郁", "重度抑郁"],
                universityList:[],
                stuTable:[],
                sizeMap:{0:10,0.5:15,1:20,1.5:25,2:30,2.5:35,3:40},
                score:[0, 0, 0, 0, 0, 0, 0, 0],
                row:[]
            }
        }
    }
</script>

<style scoped>

</style>
